package com.cedric.yixianpai.game.cards.Sects.swordCards.a_LianQi;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 剑劈
 */
@Component
public class JianPi extends SwordCard {

    /**
     * 剑劈
     * 4/5/6+*2/3/4剑意
     */
    public JianPi(@Value("1") int level) {
        super("剑劈");
        this.setPeriod(Period.LIANQI);
        this.setDescription(" 4/5/6攻 +2/3/4剑意");

        if (level == 1) {
            this.setSwordIntent(2);
            this.setLevel(1);
        } else if (level == 2) {
            this.setDamage(5);
            this.setSwordIntent(3);
            this.setLevel(2);
        } else if (3 == level) {
            this.setDamage(6);
            this.setSwordIntent(4);
            this.setLevel(3);
        } else {
            throw new RuntimeException("错误的卡牌等级！");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.attack(Sta2,this.getDamage());
        Sta1.getPlayerBuff().setSwordIntent(0);
        Sta1.getPlayerBuff().addSwordIntent(this.getSwordIntent());
        return true;
    }
}
